<template>

  <div>
    <a-card :bordered="false" class="card-info mb-24 widget-1" style="margin-left: 12px;margin-right: 12px">
      <h1>{{formData.tittle}}</h1>
      <el-divider style="margin: 0!important;"></el-divider>
      <p class="info">行骗者相关信息：{{formData.jugglerInfo}}</p>
      <el-divider direction="vertical"></el-divider>
      <!--TODO:是否默需要隐藏-->
      <p class="info">受害者联系方式：{{formData.suffererInfo}}</p>

      <div class="content" v-html="formData.content">

        <br>
      </div>
      <el-divider style="margin: 0!important; cursor: pointer !important;" @click="report">举报/反馈</el-divider>
    </a-card>

  </div>
</template>

<script>
export default {
  name: "CasePost",
  data(){
    return{
      formData:{
        caseId: 0,
        tittle: '',
        //TODO: 名称待定
        jugglerInfo: '',
        suffererInfo: '',
        type: '',
        content: ''
      },
    }
  },
  methods:{
    report(){
      console.log("举报")
    },
    getData(){
      this.$axios({
        headers: {
          "Content-Type": "application/json;charset=UTF-8",
          "Authorization": sessionStorage.getItem("systemToken")
        },
        url: "/api/case/getCaseById", //后端请求的路径
        method: "get",
        params: {
          caseId: this.formData.caseId
        }
      }).then((response) => {
        if (response.data.status === 0) {
          this.formData.content = response.data.data.htmlDetails
          this.formData.tittle = response.data.data.caseInfo.tittle
          this.formData.suffererInfo = response.data.data.caseInfo.contact
          this.formData.jugglerInfo = response.data.data.perpetratorInfo.contact
          console.log(this.formData.content)
        }else {
          swal("参数错误","","warning")
              .then((e) => {
                this.backHistory();
              })
        }
        console.log()
      });
    },
    backHistory(){
      this.$router.go(-1);
    }
  },
  mounted() {
    this.getData()
  },
  created() {
    if (this.$route.query.caseId !== undefined) {
      // console.log(this.$route.query.email)
      this.formData.caseId = this.$route.query.caseId
    }else {
      swal("非法请求","","warning")
          .then((e) => {
            this.backHistory();
          })
    }
  }

}
</script>

<style scoped>
h1{
  font-size: 28px;
}
.info{
  margin-top: 0;
  margin-bottom: 0;
  font-size: 14px !important;
  display: inline;
}

.el-divider--horizontal {
  margin: 10px 0;
}

h2{
  font-size: 21px;
}
p{
  margin-top: 3px;
  margin-bottom: 3px;
}

.content  /deep/ img{
    width: 30%;
  }



.content{
  margin-top: 25px;
}
.el-divider__text{
  cursor: pointer;
}
</style>